<?php

namespace App\Http\Controllers;

use Illuminate\Support\Facades\DB;

class UserController extends Controller
{
    public function index()
    {
        if (isset($_POST['search'])&&!empty($_POST['search'])) {
            $data = DB::table("admins")->where('username', 'like', '%' . $_POST['search'] . '%')->get();
        } else {
            $data = DB::table("admins")->get();
        }
        return view('user')->with("data", $data);
    }

}
